package com.nonobank.architecture.schedule;

import com.taobao.pamirs.schedule.IScheduleTaskDeal;
import com.taobao.pamirs.schedule.IScheduleTaskDealMulti;
import com.taobao.pamirs.schedule.TaskItemDefine;

import java.util.Comparator;
import java.util.List;

/**
 * Created by wuchuanhong on 2016/8/25.
 */
public abstract class AbstractTaskDealMulti<T> implements IScheduleTaskDealMulti<T> {
    public final boolean execute(T[] tasks, String ownSign) throws Exception {
        return handleTask(tasks,ownSign);
    }

    public final List<T> selectTasks(String taskParameter, String ownSign, int taskItemNum, List<TaskItemDefine> taskItemList, int eachFetchDataNum) throws Exception {

        return queryTasks(taskParameter,ownSign,taskItemNum,taskItemList,eachFetchDataNum);
    }

    protected abstract boolean handleTask(T[] tasks, String ownSign) throws Exception;

    protected abstract List<T> queryTasks(String taskParameter, String ownSign, int taskItemNum, List<TaskItemDefine> taskItemList, int eachFetchDataNum) throws Exception;


}
